package com.example.moviecms2.controller;

import com.example.moviecms2.domain.Actor;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

/**
 * 测试控制器类
 */
@Controller
@RequestMapping(value = "/hello")
public class HelloController {

    @RequestMapping(value = "/test",method = RequestMethod.GET)
    public void test(){
        System.out.println("this is HelloController test");
    }
    @RequestMapping(value = "/test2/{id}")
    public void test2(@PathVariable String id){
        System.out.println(">>>>>>>>>>>>>>>>>>>"+id);
    }

    @ResponseBody
    @RequestMapping(value = "/aa/{id}/{name}")
    public Actor test3(@PathVariable  Long id, @PathVariable String name){
        System.out.println(">>>>>>>>>>>>>>>>>>>>>");
         Actor actor = new Actor();
         actor.setId(id);
         actor.setName(name);
         return actor;

    }
    @RequestMapping(value = "/say",method = RequestMethod.GET)
    public String say(Model model){
        model.addAttribute("greet","Hello Thymeleaf!");
        return "hello/say";
    }
}
